* {
    box-sizing: content-box;
}

body {
    background-color: #fff;
    font-family: sans-serif;
    font-size: 12px;
    min-width: 480px;
    max-width: 1024px;
    width: 100%;
    margin: 0;
    margin-left: auto;
    margin-right: auto;
}

.side-panel body {
    background-color: #fbfbfb;
}

button {
    padding-top: 5px;
    padding-bottom: 5px;
    padding-left: 8px;
    padding-right: 8px;
    border-width: 1px;
}

button:not([disabled]):hover {
    background-color: #ededed;
}

button,
select,
input[type=text],
input[type=password] {
    background-color: transparent;
    border-color: rgb(191, 191, 191);
    border-style: solid;
    border-radius: 2px;
    border-width: 1px;
    color: black;
}

input[type=checkbox] {
    margin-bottom: 1px;
}

button:active {
    border-color: rgb(237, 237, 237);
}

button:focus {
    border-color: black;
    background-color: #fefefe;
}

input {
    margin-left: 5px;
}

input[type="text"],
input[type="password"] {
    min-width: 70%;
}

input[type="number"] {
    max-width: 50px;
}

select {
    min-height: 20px;
}

#profileNamesInput {
    min-height: 22px;
}

input.small-input {
    max-width: 3ch;
}

input.medium-input {
    min-width: 50%;
}

input.large-input {
    min-width: 60px;
}

.option-input {
    display: flex;
}

#filenameMaxLengthUnitInput {
    margin-left: 2px;
}

h3 {
    display: flex;
    padding-left: 8px;
    padding-top: 5px;
    margin-right: 10px;
    min-height: 28px;
    margin-top: 8px;
}

h3 a {
    padding-left: 5px;
}

.sync-input {
    margin-bottom: 20px;
    text-align: right;
}

.sync-input input {
    margin: 0;
    margin-right: 4px;
    vertical-align: bottom;
}

.buttons {
    white-space: nowrap;
}

.buttons button {
    margin-left: 4px;
}

.profiles {
    display: flex;
    flex: 0 1 auto;
    margin-left: 8px;
    justify-content: flex-end;
}

.options-title {
    flex: 1;
    white-space: nowrap;
}

.help-icon-wrapper {
    white-space: nowrap;
}

.help-icon {
    vertical-align: middle;
    display: inline-block;
    margin-left: 3px;
}

.help-icon>img {
    border-radius: 50%;
    border: 1px black solid;
    opacity: .2;
    width: 12px;
    margin-top: 4px;
    margin-bottom: 2px;
    margin-left: 8px;
    margin-right: 8px;
    transition: opacity;
    transition-duration: 200ms;
    cursor: pointer;
}

.help-icon>img:hover {
    opacity: .4;
}

.help-content {
    margin-top: 4px;
    margin-left: 8px;
    margin-bottom: 12px;
    border: 1px #bfbfbf dotted;
    border-radius: 4px;
    padding: 2px;
    background-color: #fffdde;
    line-height: 1.6em;
}

.help-content img {
    max-height: 1em;
}

.help-content a {
    padding: 0px;
}

.help-content p {
    margin: 6px;
}

.help-content ul {
    margin: 4px;
    padding-left: 25px;
}

.help-content li {
    margin: 2px;
}

.rules-table-container * {
    box-sizing: border-box;
}

.rules-table-container {
    width: calc(100% - 10px);
    border-spacing: 0;
    border-color: rgb(191, 191, 191);
    border-style: solid;
    border-width: 1px;
    margin-top: 24px;
    margin-left: 6px;
}

.rules-table-container .tr {
    height: 26px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 64px;
}

.rules-table-container.compact .tr {
    grid-template-columns: 1fr 1fr 64px;
}

.rules-table-container.compact .tr .rule-autosave-profile {
    display: none;
}

.rules-table-container .tr[hidden] {
    display: none;
}

.rules-table-container .thead {
    text-align: left;
    border-color: rgb(225, 225, 225);
    border-style: solid;
    border-width: 0;
    border-bottom-width: 1px;
}

.rules-table-container .th,
.rules-table-container .td {
    padding: 4px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    align-self: center;
}

.rules-table .td:first-of-type {
    padding-right: 8px;
}

.rules-table .td:last-of-type {
    text-align: right;
}

.rules-data {
    max-height: 552px;
    overflow-y: auto;
    padding-top: 2px;
    padding-bottom: 2px;
    scrollbar-width: thin;
}

::-webkit-scrollbar {
    width: 6px;
    background-color: #cdcdcd;
}

::-webkit-scrollbar-thumb {
    background-color: #38383d;
}

.profiles button,
.rules-table-container button {
    padding: 0;
    margin: 0;
    text-align: center;
    margin-left: 4px;
    min-width: 22px;
}

.rules-table-container .thead .tr {
    min-height: 32px;
}

.rules-table-container .thead .th:last-of-type {
    text-align: right;
}

.profiles button,
.profiles select,
.rules-table-container button,
.rules-table-container select,
.rules-table-container input {
    height: 22px;
    vertical-align: top;
}

.rules-table-container input {
    width: 100%;
    height: 20px;
    margin: 0;
    padding: 0;
    padding-left: 2px;
    padding-right: 2px;
}

.rules-table-container .rule-create {
    margin-top: 8px;
    margin-bottom: 3px;
}

.profiles select {
    width: calc(100% - 86px);
    text-align-last: right;
    padding: 0px;
    padding-left: 4px;
    padding-right: 4px;
}

.rules-table-container select {
    max-width: 100%;
}

.profiles button:disabled,
.rules-table-container button:disabled {
    opacity: .25;
}

.profiles button>img,
.rules-table-container button>img {
    width: 14px;
    height: auto;
    vertical-align: middle;
    padding: 2px;
    box-sizing: content-box;
}

.rules-table-container+.option label,
.rules-table-container+.option+.option label {
    text-align: right;
    width: 100%;
    align-self: center;
}

#profilesLabel {
    font-weight: normal;
    padding-top: 5px;
    margin-right: 5px;
}

details {
    color: #555;
    margin-left: 6px;
    margin-right: 12px;
    margin-bottom: 4px;
    border-top: #bfbfbf 1px dashed;
}

details:last-of-type {
    border-bottom: #bfbfbf 1px dashed;
}

details>summary {
    color: black;
    padding-bottom: 7px;
    padding-top: 7px;
    margin-bottom: 3px;
    margin-top: 3px;
    padding-left: 6px;
    cursor: pointer;
}

details[open]>summary {
    cursor: pointer;
    outline-width: 0px;
}

a {
    display: inline-block;
    padding-top: 5px;
}

.option.second-level {
    margin-left: 10px;
}

.option:not([hidden]) {
    display: flex;
    justify-content: space-between;
    margin-top: 3px;
    padding-left: 8px;
    padding-bottom: 2px;
    min-height: 24px;
    align-items: center;
}

.option.vertical {
    flex-direction: column;
}

.option.vertical label {
    align-self: flex-start;
    min-height: 24px;
}

.option.vertical input {
    margin-top: 4px;
    align-self: flex-end;
    width: calc(100% - 6px);
    margin-bottom: 2px;
    padding: 2px;
}

.option:last-of-type {
    padding-bottom: 12px;
}

.option:first-of-type {
    padding-top: 6px;
}

.option.bottom {
    padding-top: 24px;
    padding-right: 12px;
    padding-bottom: 12px;
    padding-left: 12px;
}

#expandAllButton {
    font-family: monospace;
    display: inline-block;
    min-width: 7px;
    max-width: 7px;
    margin-left: 5px;
    opacity: .4;
    transition: opacity 250ms;
    cursor: pointer;
    font-size: 1.1em;
    position: relative;
    top: -1px;
    left: -2px;
}

#expandAllButton::after {
    content: '+';
}

#expandAllButton.opened::after {
    content: '-';
}

#expandAllButton:hover {
    opacity: 1;
}

.popup {
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    background-color: rgba(191, 191, 191, .75);
    display: none;
}

.popup-content {
    align-self: flex-start;
    width: 90%;
    max-width: 320px;
    margin-top: 100px;
    margin-bottom: 100px;
    margin-left: auto;
    margin-right: auto;
    background-color: white;
    box-shadow: 5px 5px #ababab;
}

.popup-content header {
    padding-top: 10px;
    padding-left: 10px;
    padding-bottom: 20px;
    font-size: 14px;
    line-height: 20px;
}

.popup-content main {
    padding-top: 10px;
    padding-left: 10px;
    padding-bottom: 10px;
}

.popup-content main input {
    margin-bottom: 10px;
    padding: 2px;
    font-size: 13px;
    margin-left: 0px;
    width: calc(100% - 16px);
}

.popup-content footer {
    text-align: right;
    padding-left: 10px;
    padding-right: 10px;
}

.popup-content footer button {
    margin-bottom: 10px;
    margin-left: 4px;
}

.side-panel .profiles {
    max-width: unset;
}

.side-panel .profiles {
    top: 0px;
    min-width: calc(100% - 12px);
}

.side-panel .profiles select {
    min-width: calc(100% - 78px);
    text-align-last: auto;
    padding-right: 0;
}

.side-panel .options-title,
.side-panel .option.bottom {
    display: none;
}

.side-panel h3 {
    margin-top: 0;
}

.maximized body {
    margin-top: 8px;
}

.maximized body>main {
    margin: 0px;
    border: solid 1px rgb(191, 191, 191);
    background-color: #fbfbfb;
}

html.maximized {
    background-color: #f0f0f0;
}

.maximized .profiles {
    position: relative;
    top: -4px;
}

.maximized #helpLabel {
    padding-left: 4px;
    padding-right: 4px;
    padding-top: 0;
}

@media (max-width:279px) {
    h3 {
        flex-direction: column;
    }

    .profiles,
    .maximized .profiles {
        position: static;
        margin-top: 8px;
        margin-left: 16px;
        max-width: 100%;
        justify-content: flex-start;
    }

    .side-panel .profiles {
        margin-top: 0;
        margin-left: 0;
        margin-right: 8px;
        justify-content: inherit;
    }

    .profiles select {
        text-align-last: auto;
        padding-right: 0;
    }
}

@media (max-width:479px) {
    body {
        min-width: auto;
    }

    body,
    input,
    select,
    button {
        font-size: 11px;
    }
}

@media (prefers-color-scheme: dark) {

    ::-webkit-scrollbar {
        background-color: #2A2A2E;
    }

    ::-webkit-scrollbar-thumb {
        background-color: #555;
    }

    details {
        color: #ccc;
    }

    html {
        background-color: #202023;
    }

    html.maximized {
        background-color: #373737;
    }

    main,
    .maximized body>main,
    details>summary,
    button,
    select,
    .popup-content {
        background-color: #23222b;
        color: #fdfdfd;
    }

    .side-panel,
    .side-panel body>main,
    .side-panel details>summary,
    .side-panel button,
    .side-panel select,
    .side-panel .popup-content {
        background-color: #38383d;
    }

    .maximized body>main {
        border-color: rgb(81, 81, 81);
    }

    .new-window-link img,
    .profiles button img {
        filter: invert(100%);
    }

    .profiles button img:hover {
        filter: invert(0%);
    }

    .profiles button[disabled] {
        opacity: .4;
    }

    .profiles button[disabled] img {
        filter: invert(50%);
    }

    .help-icon>img {
        opacity: .6;
        border-color: #ccc;
    }

    .help-icon>img:hover {
        opacity: .8;
    }

    input[type="text"],
    input[type="password"] {
        background-color: #fff;
    }

    button:not([disabled]):hover {
        color: #2A2A2E;
    }

    button:focus {
        color: black;
        border-color: black;
        background-color: #d2d2d2;
    }

    .help-content {
        background-color: rgb(85, 85, 97);
    }

    .rules-table-container,
    .rules-table-container .thead {
        border-color: rgb(85, 85, 97);
    }

    a,
    a:visited {
        color: white;
    }

    .popup {
        background-color: rgba(59, 59, 59, 0.95);
    }

    .popup-content {
        box-shadow: 5px 5px #000000;
    }

}